<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">PDFGMM</b>
<td valign="baseline" align="right" class="function"><a href="../probab/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Evaluates gaussian mixture model.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;=&nbsp;pdfgmm(X,&nbsp;model&nbsp;)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;This&nbsp;function&nbsp;evaluates&nbsp;a&nbsp;probability&nbsp;density&nbsp;function&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;determined&nbsp;by&nbsp;Gaussian&nbsp;mixture&nbsp;model&nbsp;(GMM)&nbsp;for&nbsp;given&nbsp;input&nbsp;column&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;vectors&nbsp;in&nbsp;X.&nbsp;The&nbsp;GMM&nbsp;is&nbsp;defined&nbsp;as</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;y(i)&nbsp;=&nbsp;sum&nbsp;model.Prior(j)*pdfgauss(X(:,i),model.Mean(:,j),model.Cov(:,:,j))</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j=1:ncomp</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;for&nbsp;all&nbsp;i=1:size(X,2).</span><br>
<span class=help>&nbsp;</span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Input&nbsp;matrix&nbsp;of&nbsp;column&nbsp;vectors.</span><br>
<span class=help>&nbsp;&nbsp;model.Mean&nbsp;[dim&nbsp;x&nbsp;ncomp]&nbsp;Means&nbsp;of&nbsp;Gaussians.</span><br>
<span class=help>&nbsp;&nbsp;model.Cov&nbsp;[dim&nbsp;x&nbsp;dim&nbsp;x&nbsp;ncomp]&nbsp;Covarince&nbsp;matrices.</span><br>
<span class=help>&nbsp;&nbsp;model.Prior&nbsp;[ncomp&nbsp;x&nbsp;1]&nbsp;Weights&nbsp;of&nbsp;components.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Values&nbsp;of&nbsp;probability&nbsp;density&nbsp;function.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help></span><br>
<span class=help>&nbsp;Univariate&nbsp;case</span><br>
<span class=help>&nbsp;&nbsp;x&nbsp;=&nbsp;linspace(-5,5,100);</span><br>
<span class=help>&nbsp;&nbsp;distrib&nbsp;=&nbsp;struct('Mean',[-2&nbsp;3],'Cov',[1&nbsp;0.5],'Prior',[0.4&nbsp;0.6]);</span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;=&nbsp;pdfgmm(x,distrib);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;plot(x,y);</span><br>
<span class=help></span><br>
<span class=help>&nbsp;Multivariate&nbsp;case</span><br>
<span class=help>&nbsp;&nbsp;model.Mean(:,1)&nbsp;=&nbsp;[-1;-1];&nbsp;model.Cov(:,:,1)&nbsp;=&nbsp;[1,0.5;0.5,1];&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;model.Mean(:,2)&nbsp;=&nbsp;[1;1];&nbsp;model.Cov(:,:,2)&nbsp;=&nbsp;[1,-0.5;-0.5,1];&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;model.Prior&nbsp;=&nbsp;[0.4&nbsp;0.6];</span><br>
<span class=help>&nbsp;&nbsp;[Ax,Ay]&nbsp;=&nbsp;meshgrid(linspace(-5,5,100),&nbsp;linspace(-5,5,100));</span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;=&nbsp;pdfgmm([Ax(:)';Ay(:)'],model);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;surf(&nbsp;Ax,&nbsp;Ay,&nbsp;reshape(y,100,100));&nbsp;shading&nbsp;interp;</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../probab/gmmsamp.html" target="mdsbody">GMMSAMP</a>,&nbsp;<a href = "../probab/pdfgauss.html" target="mdsbody">PDFGAUSS</a>.</span><br>
<span class=help></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../probab/list/pdfgmm.html">pdfgmm.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 28-apr-2004, VF<br>

</body>
</html>
